import java.util.*;

public class Main {
        public static int findMinimum(int n, int[] left, int[] right) {
            // write code here
            int max1 = 0, max2 = 0;
            int sum1 = 0, sum2 = 0;
            for (int i = 0; i < n; i++) {
                sum1 += left[i];
                sum2 += right[i];
                for (int j = i+1;j < n ; j++) {
                    if (left[i] > left[j]) {
                        int tmp = left[i];
                        left[i] = left[j];
                        left[j] = tmp;
                    }
                    if (right[i] > right[j]) {
                        int tmp = right[i];
                        right[i] = right[j];
                        right[j] = tmp;
                    }
                }

            }
            max1 = sum1 - left[n-1] - left[n-2] + 1;
            max2 = sum2 -right[n-2] + 1;
            return max1 + max2;
        }

    public static void main(String[] args) {
        int n = 4;
        int[] left = {0,7,1,6};
        int[] right = {1,5,0,6};
        System.out.println(findMinimum(n, left, right));
    }

}
